#!/bin/bash
if [ $1 != "" ]; then
  DATA_FILENAME=$1
else
  echo "Defaulting saved data filename to data.m"
  DATA_FILENAME=data.m
fi;
echo -e "%% Received pkts Sequence number & Tx channel" > $DATA_FILENAME
echo -e "mtrx=[" > $DATA_FILENAME
tcpdump -i ath0 -X 'port 12345' -c 1300  |awk '$1 == "0x0010:" {printf("%s",$9); }; $1 == "0x0020:" {printf(" hex2dec(\47%s\47) / 256\n", $2);}' >> $DATA_FILENAME
echo -e "];" >> $DATA_FILENAME
